// 云函数入口文件
const cloud = require('wx-server-sdk')
var rp = require('request-promise')
cloud.init()

// 云函数入口函数
exports.main = async (event, context) => {
  //get
  const get_options = {

    method: 'GET',

    url: 'https://tenapi.cn/video/',
    qs: {

     url:'https://h5.pipix.com/s/eBks6tv/'
    },
    json: true
  };

  //获取get请求数据

  const get_res = await rp(get_options);

  post
  const post_options = {
    method: 'POST',
    url: 'https://xxxx.com',
    body: {
      'aa': "aa",
      'bb': "bb",
      'cc': "cc"
    },
    json: true
  };

  // 获取post请求数据
  const post_res = await rp(post_options);
  return {
    get_res,
    post_res
  }
}